Skip to content

Add CI workflow to run tests on push and pull requests#2

Merged
jkyberneees merged 1 commit intomainfrom
ci/add-github-actions-workflows
Mar 7, 2026
Merged

Add CI workflow to run tests on push and pull requests#2
jkyberneees merged 1 commit intomainfrom
ci/add-github-actions-workflows

Conversation

@jkyberneees
Copy link
Contributor

No description provided.

Comment on lines +11 to +30
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Build
run: go build ./...

- name: Vet
run: go vet ./...

- name: Test
run: go test -race ./...

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 16 days ago

In general, the fix is to explicitly declare minimal GITHUB_TOKEN permissions either at the workflow root or per job. Since all jobs here are just running CI against the code, they only need read access to the repository contents. The best minimal fix is to add permissions: contents: read at the workflow level so it applies to all jobs without changing current behavior beyond reducing unnecessary permissions.

Concretely, in .github/workflows/ci.yml, add a new permissions: block near the top-level, just under the name: CI line and before on:. This will set contents: read for all jobs in this workflow. No imports or additional methods are needed, as this is purely a YAML configuration change.

Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,5 +1,8 @@
 name: CI
 
+permissions:
+  contents: read
+
 on:
   push:
     branches: ["**"]
EOF
@@ -1,5 +1,8 @@
name: CI

permissions:
contents: read

on:
push:
branches: ["**"]
Copilot is powered by AI and may make mistakes. Always verify output.
@jkyberneees jkyberneees merged commit c19bc4b into main Mar 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant